package com.zhida.jiyangcenter.mian

import android.graphics.Color
import android.os.Bundle
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.StaggeredGridLayoutManager
import chooongg.base.annotation.ContentLayout
import chooongg.base.annotation.TitleBar
import chooongg.base.utils.startActivity
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.vivian.timelineitemdecoration.itemdecoration.DotItemDecoration
import com.zhida.jiyangcenter.R
import com.zhida.jiyangcenter.membership.MembershipBuyActivity
import kotlinx.android.synthetic.main.activity_main_home_left.*

@TitleBar(false)
@ContentLayout(R.layout.activity_main_home_left)
class MainHomeLeftActivity:BaseActivity() {
    override fun initConfig(savedInstanceState: Bundle?) {
        title_bar.navigationIcon(R.drawable.iv_back_fill){
            finish()
        }
        ll_member.setOnClickListener {
            startActivity<MembershipBuyActivity> {  }
        }
        rv_pubuliu.layoutManager= StaggeredGridLayoutManager(3, StaggeredGridLayoutManager.HORIZONTAL)
        rv_pubuliu.addItemDecoration(DotItemDecoration
                .Builder(this)
                .setOrientation(DotItemDecoration.HORIZONTAL)//如果LayoutManager设置了横向，那么这里也要设置成横向
                .setTopDistance(20f)//单位dp
                .setItemInterVal(10f)//单位dp
                .setItemPaddingLeft(10f)//如果不设置，默认和item间距一样
                .setItemPaddingRight(10f)//如果不设置，默认和item间距一样
                .setDotColor(Color.WHITE)
                .setDotRadius(2)//单位dp
                .setDotPaddingTop(0)
                .setDotInItemOrientationCenter(false)//设置dot居中
                .create())
        rv_pubuliu.adapter=Adapter().apply {
            setNewData(ArrayList<String>().apply {
                add("经络穴位导引推拿")
                add("针灸刺络奇特疗法")
                add("中医针灸疗法")
                add("艾薰培补元阳疗法")
                add("群罐循经排毒疗法")
                add("肩颈理疗项目")
                add("艾薰培补元阳疗法")
                add("群罐循经排毒疗法")
            })
        }
    }
    class Adapter:BaseQuickAdapter<String,BaseViewHolder>(R.layout.item_pubuliu){
        override fun convert(helper: BaseViewHolder, item: String?) {
            helper.setText(R.id.text_view_pubuliu,item)
        }

    }
}